{# Copyright The IETF Trust 2016, All Rights Reserved #}
{% load origin %}
{% origin %}
{% load ietf_filters ballot_icon person_filters textfilters %}
<div class="card mb-3">
    <div class="position-absolute top-0 end-0 m-3">{% ballot_icon doc %}</div>
    <div class="card-body">
        <div class="row">
            <div class="col-3 text-end fw-bold">{{ doc.intended_std_level }}</div>
            <div class="col pe-5 me-5">
                <b>{{ doc.title }}</b>
            </div>
        </div>
        <div class="row">
            <div class="col-3 text-end fw-bold">
                {% if doc.stream %}{{ doc.stream }} stream{% endif %}
            </div>
            <div class="col">
                {% with doc.rfc_number as rfc_number %}
                    <a href="{% if rfc_number %} https://www.rfc-editor.org/rfc/rfc{{ rfc_number }}/ {% else %} {{ doc.get_href }} {% endif %}" aria-label="Content"><i class="bi bi-file-earmark-fill"></i></a>
                {% endwith %}
                <a href="{% url "ietf.doc.views_doc.document_main" name=doc.name %}">{{ doc.name }}</a>
                {% if doc.has_rfc_editor_note %}
                    <a href="{% url "ietf.doc.views_doc.document_main" name=doc.name %}writeup/">
                        <em>(Has RFC Editor Note)</em>
                    </a>
                {% endif %}
            </div>
        </div>
        {% if doc.note %}
            <div class="row">
                <div class="col-3 text-end fw-bold">Note</div>
                <div class="col">{{ doc.note|urlize_ietf_docs|linkify|linebreaksbr }}</div>
            </div>
        {% endif %}
        <div class="row">
            <div class="col-3 text-end fw-bold">Token</div>
            <div class="col">
                {% person_link doc.ad %}
                <a href="{% url 'ietf.group.views.active_groups' group_type='wg' %}#{{ doc.group.parent.acronym|upper }}">
                    ({{ doc.group.parent.acronym|upper }})
                </a>
            </div>
        </div>
        {% with doc.active_defer_event as defer %}
            {% if defer %}
                <div class="row">
                    <div class="col-3 text-end fw-bold">Deferred by</div>
                    <div class="col">{{ defer.by }} on {{ defer.time|date:"Y-m-d" }}</div>
                </div>
            {% endif %}
        {% endwith %}
        {% if doc.iana_review_state %}
            <div class="row">
                <div class="col-3 text-end fw-bold">IANA review</div>
                <div class="col {% if doc.iana_review_state|slice:7 != "IANA OK" %}text-danger{% else %}text-success{% endif %}">
                    {{ doc.iana_review_state }}
                </div>
            </div>
        {% endif %}
        {% if doc.consensus %}
            <div class="row">
                <div class="col-3 text-end fw-bold">Consensus</div>
                <div class="col {% if doc.consensus != "Yes" %}text-danger{% else %}text-success{% endif %}">{{ doc.consensus }}</div>
            </div>
        {% endif %}
        {% if doc.review_assignments %}
            <div class="row">
                <div class="col-3 text-end fw-bold">Reviews</div>
                <div class="col">
                    {% for review_assignment in doc.review_assignments %}
                        {% include "doc/review_assignment_summary.html" with current_doc_name=doc.name current_rev=doc.rev %}
                    {% endfor %}
                </div>
            </div>
        {% endif %}
        {% if doc.lastcall_expires %}
            <div class="row">
                <div class="col-3 text-end fw-bold">Last call expires</div>
                <div class="col">{{ doc.lastcall_expires|date:"Y-m-d" }}</div>
            </div>
        {% endif %}
        {% if doc.ipr %}
            <div class="row">
                <div class="col-3 text-end fw-bold">IPR</div>
                <div class="col">
                    {% for ipr in doc.ipr %}
                        {% if ipr.disclosure.state_id == "posted" %}
                            <div>
                                <a href="{% url 'ietf.ipr.views.show' id=ipr.disclosure.id %}">{{ ipr.disclosure.title }}</a>
                            </div>
                        {% endif %}
                    {% endfor %}
                </div>
            </div>
        {% endif %}
    </div>
</div>